<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
    <title>查看计划</title> 


    <link type="text/css" href="/TopJUI/topjui/css/topjui.core.min.css" rel="stylesheet">
    <link type="text/css" href="/TopJUI/topjui/themes/default/topjui.green.css" rel="stylesheet" id="dynamicTheme"/>
    <!-- FontAwesome字体图标 -->
    <link type="text/css" href="/TopJUI/topjui/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet"/>
    <!-- 图片上传样式 -->
    <link type="text/css" href="/TopJUI/upload/css/upload.css" rel="stylesheet"/>
    <!-- jQuery相关引用 -->
    <script type="text/javascript" src="/TopJUI/topjui/plugins/jquery/jquery.min.js"></script>
    <script type="text/javascript" src="/TopJUI/topjui/plugins/jquery/jquery.cookie.js"></script>
    <!-- TopJUI框架配置 -->
    <script type="text/javascript" src="/TopJUI/static/public/js/topjui.config.js"></script>
    <!-- TopJUI框架核心-->
    <script type="text/javascript" src="/TopJUI/topjui/js/topjui.core.min.js"></script>
    <!-- TopJUI中文支持 -->
    <script type="text/javascript" src="/TopJUI/topjui/js/locale/topjui.lang.zh_CN.js"></script>

    <script type="text/javascript" src="/pages/js/moment.min.js"></script>
    <script type="text/javascript" src="/pages/js/layer/layer.js"></script>
    <script type="text/javascript" src="/pages/js/util.js"></script>
    <script type="text/javascript" src="/pages/js/shuoheUtil.js"></script>
    
    <!-- 图片上传js -->
    <script type="text/javascript" src="/TopJUI/upload/js/upload.js"></script>

    
    
<style type="text/css">
    html, body{ margin:0; height:100%;width: 100%;overflow: auto;}
</style>



<body>
   <table class="editTable" style="text-align: center;" >
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">计划信息</span>
                </div>
            </td>
        </tr>               
        <tr>
            <td class="label">项目编号</td>
            <td >
                <input id='project_id' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>

            <td class="label">项目名称</td>
            <td >
                <input id='project_name' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>
        </tr>
         <tr>
            <td class="label">项目阶段</td>
            <td >                
                <input id='project_stage' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>                
            </td>

            <td class="label"></td>
            <td >
            </td>
        </tr>        
        <tr>
            <td class="label">计划内容</td>
            <td >                
                <input id='plan_content' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>                
            </td>

            <td class="label"></td>
            <td >
            </td>
        </tr>
        <tr>
            <td class="label">任务一级分解</td>
            <td >                
                <input id='task_level_1' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>                

            <td class="label">任务二级分解</td>
            <td >                
                <input id='task_level_2' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>  
        </tr>
        <tr>
            <td class="label">任务三级分解</td>
            <td >                
                <input id='task_level_3' class="easyui-textbox" data-options="required:false,width:200,editable:true" disabled>
            </td>                            
        </tr>        
        <tr>            
            <td class="label">计划起始时间</td>
            <td >                
                <input id='plan_start_date' class="easyui-datebox" data-options="required:false,width:200,editable:true" disabled>
            </td>                
            </td>

            <td class="label">计划结束时间</td>
            <td >
                <input id='plan_end_date' class="easyui-datebox" data-options="required:false,width:200,editable:true" disabled>
            </td>
        </tr>
        <tr>            
            <td class="label">计划人天</td>
            <td >                
                <input id='plan_manday' class="easyui-numberbox" data-options="required:false,width:200,editable:true" disabled>
            </td>                
            </td>
        </tr>
        <tr>
            <td class="label">完成时间</td>
            <td >                
                <input id='finish_date' class="easyui-datebox" data-options="required:false,width:200,editable:true" disabled>
            </td>   
            </td>             
        </tr>     
        <tr>
            <td class="label">完成情况</td>
            <td colspan="3">                
                <input id='task_response' class="easyui-textbox" data-options="required:false,width:554,editable:true,multiline:true,height:80" disabled>
            </td>  
        </tr>                 
        <tr>
            <td class="label" colspan="4" style="text-align: left;font-size: 20px;">
                <div class="divider">
                    <span style="margin-left: 50px">开发人员</span>
                </div>
            </td>
        </tr>         
        <tr>
            <td colspan="4">
                <div class="easyui-panel" style="width: 700px; margin-left: 143px; margin-top: 0px" data-options=" border:false">
                    <table id="dg3" class="easyui-datagrid" title="" style="width:554px;height:auto"
                        data-options="
                            iconCls: 'icon-edit',
                            singleSelect: true,
                            method: 'get'
                        ">
                    <thead>
                    <tr>
                        <th field="id" hidden="true">编号</th>
                        <th field="user_id" style="width: 30%">编号</th>
                        <th field="name" style="width: 30%">姓名</th>
                    </tr>
                    </thead>
                    </table>
                </div>
            </td>
        </tr>

     
    </table>
    
</body> 
</html>
<script type="text/javascript">

    var project = new Object();
    var masterPlan = new Object();


    $(function(){

        $.ajax({
            url: '/develop/url/getUrl.do',
            type: "POST",
            dataType: 'json',
            data: {
                'name': 'getProjctForObjectById',
                'id':shuoheUtil.getUrlHeader().project_id
            },
            error: function() //失败
            {
                shuoheUtil.layerSaveMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerSaveMaskOff();
                project = data;
                $('#project_id').textbox('setValue',data.project_id);
                $('#project_name').textbox('setValue',data.project_name);
            }
        });

        $.ajax({
            url: '/develop/url/getUrl.do',
            type: "POST",
            dataType: 'json',
            data: {
                'name': 'getMasterPlanById',
                'id':shuoheUtil.getUrlHeader().id
            },
            error: function() //失败
            {
                shuoheUtil.layerSaveMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerSaveMaskOff();
                console.info(data);
                masterPlan = data;
                $('#plan_content').textbox('setValue',masterPlan.plan_content);
                $('#plan_start_date').datebox('setValue',masterPlan.plan_start_date);
                $('#plan_end_date').datebox('setValue',masterPlan.plan_end_date);
                $('#plan_manday').numberbox('setValue',masterPlan.plan_manday);
                $('#project_stage').textbox('setValue',masterPlan.project_stage);
                $('#task_level_1').textbox('setValue',masterPlan.task_level_1);
                $('#task_level_2').textbox('setValue',masterPlan.task_level_2);
                $('#task_level_3').textbox('setValue',masterPlan.task_level_3);

                $('#finish_date').datebox('setValue',masterPlan.finish_date);
                $('#task_response').textbox('setValue',masterPlan.task_response);
            }
        });

    $('#dg3').datagrid({
        url: '/develop/url/getUrl.do',
        queryParams: {
            'name': 'getDeveloperByMasterPlanId' ,
            'id': shuoheUtil.getUrlHeader().id
        },
        method: 'get'
    })



    })


    function save() {

        shuoheUtil.layerTopMaskOn();


        masterPlan.plan_content = $('#plan_content').textbox('getValue');
        masterPlan.plan_start_date = $('#plan_start_date').datebox('getValue');
        masterPlan.plan_end_date = $('#plan_end_date').datebox('getValue');
        masterPlan.plan_manday = $('#plan_manday').numberbox('getValue');
        masterPlan.project_stage = $('#project_stage').textbox('getValue');
        masterPlan.task_level_1 = $('#task_level_1').textbox('getValue');
        masterPlan.task_level_2 = $('#task_level_2').textbox('getValue');
        masterPlan.task_level_3 = $('#task_level_3').textbox('getValue');

        var rows = $('#dg3').datagrid('getRows');

        $.ajax({
            url:'/pm2/plan/saveMasterPlan.do',
            type: "POST",
            dataType: 'json',
            data: {
                'data': JSON.stringify(masterPlan),
                'developer':JSON.stringify(rows)
            },
            error: function() //失败
            {
                shuoheUtil.layerTopMaskOff();
            },
            success: function(data) //成功
            {
                shuoheUtil.layerTopMaskOff();
                if (data.result == true) {
                    shuoheUtil.layerClose();
                    parent.updateSuccess();
                } else
                    shuoheUtil.layerMsgCustom(data.describe);
            }
        });
    }
</script>
<script type="text/javascript">
    function add()
    {
          layer.open({
              type: 2,
              title: '新增设备',
              shadeClose: false,
              shade: 0.3,
              maxmin: true, //开启最大化最小化按钮s
              area: ['500px','300px'],
              content: 'addDeveloper.jsp'
          })
    }
    function edit() {
        var row = $('#dg3').datagrid('getSelected');
        var dg_i = $('#dg3').datagrid('getRowIndex', $("#dg3").datagrid('getSelected'))
        if (row == null) {
            shuoheUtil.layerMsgCustom('必须选择一条数据');
            return;
        }

        layer.open({
            type: 2,
            title: '新增设备',
            shadeClose: false,
            shade: 0.3,
            maxmin: true, //开启最大化最小化按钮s
            area: ['500px', '300px'],
            content: 'editDeveloper.jsp?user_id=' + row.user_id+'&id='+dg_i
        })
    }
    function dele()
    {

    }
</script>